package com.ssm.pre.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ssm.pre.service.SystemService;
import com.ssm.util.object.InputObject;
import com.ssm.util.object.OutputObject;

/**
 * 系统设置——菜单管理
 * @author 马培淞
 *
 */
@Controller
public class SystemController {

	@Autowired
	private SystemService systemService;
	
	/**
	 * 查询一级菜单
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/SystemController/queryMenuByOneList")
	@ResponseBody
	public void queryMenuByOneList(InputObject inputObject, OutputObject outputObject) throws Exception{
		systemService.queryMenuByOneList(inputObject, outputObject);
	}
	
	/**
	 * 查询一级菜单，用作select下拉框选择
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/SystemController/queryMenuByOneSelect")
	@ResponseBody
	public void queryMenuByOneSelect(InputObject inputObject, OutputObject outputObject) throws Exception{
		systemService.queryMenuByOneSelect(inputObject, outputObject);
	}
	
	/**
	 * 根据parentId查询二级菜单
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/SystemController/queryMenuByTwoList")
	@ResponseBody
	public void queryMenuByTwoList(InputObject inputObject, OutputObject outputObject) throws Exception{
		systemService.queryMenuByTwoList(inputObject, outputObject);
	}
	
	/**
	 * 根据ID查询一条信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/SystemController/queryMenuById")
	@ResponseBody
	public void queryMenuById(InputObject inputObject, OutputObject outputObject) throws Exception{
		systemService.queryMenuById(inputObject, outputObject);
	}
	
	/**
	 * 添加菜单
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/SystemController/addMenu")
	@ResponseBody
	public void addMenu(InputObject inputObject, OutputObject outputObject) throws Exception{
		systemService.addMenu(inputObject, outputObject);
	}
	
	/**
	 * 根据ID进行删除操作
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/SystemController/deleteMenuById")
	@ResponseBody
	public void deleteMenuById(InputObject inputObject, OutputObject outputObject) throws Exception{
		systemService.deleteMenuById(inputObject, outputObject);
	}
	
	/**
	 * 根据ID修改一条菜单信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/SystemController/updateMenuById")
	@ResponseBody
	public void updateMenuById(InputObject inputObject, OutputObject outputObject) throws Exception{
		systemService.updateMenuById(inputObject, outputObject);
	}
	
}
